package middleware

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"time"
)

func ElapsedTime()gin.HandlerFunc{
	return func(g *gin.Context) {
		start:=time.Now()
		g.Next()
		since:=time.Since(start)
		funName:=g.HandlerName()
		fmt.Println(fmt.Sprintf("函数%s耗时%f秒",funName,since.Seconds()))
	}
}
